package com.xnyzc.lhy.common.util;

import lombok.Data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description 前台出参列表,链式
 * [
 *  {name: 标题, value: 内容},{name: 标题, value: 内容}
 * ]
 * @Author zhuyubin
 * @Date 2019/8/14 9:11
 **/
@Data
public class ResultListUtil {

    private List<Map<String, Object>> list = new ArrayList<>();

    public ResultListUtil add(String name, Object value){
        Map<String, Object> map = new HashMap<>(16);
        map.put("name", name);
        map.put("value", value);
        this.list.add(map);
        return this;
    }

    public ResultListUtil add(String name, Object value, Integer type){
        Map<String, Object> map = new HashMap<>(16);
        map.put("name", name);
        map.put("value", value);
        map.put("type", type);
        this.list.add(map);
        return this;
    }

    public Map<String, Object>  diDiAdd(String name, Object value,List sub_items){
        Map<String, Object> map = new HashMap<>(16);
        map.put("name", name);
        map.put("value", value);
        map.put("sub_items", sub_items);
        return map;
    }

}
